package com.riccardocardin.structured.concurrency.client;

import com.riccardocardin.structured.concurrency.model.Model;
import com.riccardocardin.structured.concurrency.service.RepositoryServiceImpl;

import java.time.Duration;
import java.util.List;
import java.util.concurrent.ExecutionException;

import static com.riccardocardin.structured.concurrency.model.Model.UserId;

public class TimeoutRepositoryDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        RepositoryServiceImpl repositoryService = new RepositoryServiceImpl();
        List<Model.Repository> repositories =
                repositoryService.findRepositories(new UserId(1L), Duration.ofMillis(2000));
        repositories.forEach(System.out::println);
    }
}
